home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
tpl60n11.zip
/
README.DOC
< prev
next >
Wrap
Text File
|
1992-04-01
|
13KB
|
259 lines
Turbo-Pascal 6.0 Runtime Libary Update - Release 1.1 Beta 04-01-1992
This library is a complete replacement for the runtime library that
came with your Turbo Pascal 6.0 compiler. Due to lots of optimizations,
programs compiled with this version of TURBO.TPL will be faster.
This library maintains 99.9% compatibility with the original library.
Differences are usually due to enhancements and should not cause
any compatibility problems. Some bugs from the original library
supplied by Borland have been eliminated, but there can be no guarantee
that new ones have not crept in. If you discover any bugs, or have
other comments, please let me know. My email and snail mail addresses
are given below. Due to the nature of Borland's licensing of the
TPL source code I am not allowed to distribute the source code of
my enhanced library, so I can only provide the binary.
Original library code is Copyright (C) 1983,91 Borland International
New / additional library code is Copyright (C) 1988-1992
Norbert Juffa, Wielandtstr. 14, 7500 Karlsruhe 1, Germany
Internet: S_JUFFA@IRAVCL.IRA.UKA.DE
Improvements in SYSTEM module
-----------------------------
o REAL type software arithmetic operations now comply with ANSI/IEEE
Standard 754-1985 for Binary Floating Point Arithmetic [1,2] as much
as possible. Note that REAL arithmetic by design differs from the
standard in many ways, especially available numeric formats, value
set, and available operations. The rounding mode implemented here
is "round to nearest or even" as specified in the standard. Add,
Subtract, Multiply, Division, and Square Root deliver exact results
with regard to this rounding mode, as demanded by the standard.
Conversions from REAL to LONGINT and from EXTENDED to REAL use
rounding to nearest or even, as specified in the standard. Correct
implementation of above features was tested with the PARANOIA test
program [3].
o REAL arithmetic operations have been sped up. Speed up is fourfold for
SQRT (up to 22x on a 80386), twofold for FRAC and between 30% and 40%
for ARCTAN, LN, EXP and division (2.5x speed up for division on 80386).
Speed increase for SIN/COS functions is smaller (about 10%) since speed
was sacrificed in favor of more accurate results here. Overall numeric
processing power using REAL arithmetic increases by about 26% for an
8086 and by 38% for an 80386 as measured by the WHETSTONE benchmark [4,5].
o Overall accuracy of REAL arithmetic transcendental functions has been
improved as indicated by Cody&Waite's ELEFUNT tests [6]: DLOG, DEXP,
DATAN, DSIN. Correct argument reduction ensures that relative error
over the whole argument range does not exceed 2.1e-12 for Exp, 3.1e-12
for Arctan, and 2.7e-12 for Ln. For Sin and Cos, relative error is
also in this range when the argument is reasonably small (e.g. in range
-100..100) and not very close to an integer multiple of 0.5*Pi. Note
that due to accurracy requirements, the range of Sin/Cos arguments has
been reduced to -9.22337e18..9.22337e18. An error 207 (invalid float
operation) will be signaled for arguments outside this range.
o Faster execution of coprocessor floating point computations using an
80287 or 80387. For these coprocessors, NOPs will be inserted before
every floating point instruction converted from an emulator interrupt
instead of WAITs. As a result of this optimization, an improvement in
execution speed of 14% has been observed running the Lawrence Livermore
Loops (LLL) [7] on a Cyrix 83D87, the improvement for the WHETSTONE
benchmark on the 83D87 is 9.4%.
o On a 80287XL, 80387, or 80846 the Sin and Cos functions take advantage
of the FSIN and FCOS instructions of these coprocessors, speeding up
these functions by almost a factor of two. Also, the Arctan function
takes advantage of the increased argument range of the FPATAN function.
These optimizations result in another 19% increase in WHETSTONE power,
so that the total combined speedup over the original library is 30%
for this benchmark.
o STRING operations are faster, especially for longer strings. Most
dramatic increase is in the INSERT function, with execution times
reduced to up to one fourth compared with the original version of RTL.
Faster string operations cause 7% performance increase for the
DHRYSTONE [8,9] benchmark on a 8086.
o Improved speed of random number generation. Random for REAL numbers
is 10% faster, Random for EXTENDED numbers is 5% faster, no speed
difference for Integer Random function.
o Binary to decimal conversions used in Str and Write procedures have
been sped up by up to 70% for integers (BYTE, SHORTINT, INTEGER,
WORD, LONGINT), up to 5% for REAL numbers and about 3% for EXTENDED
numbers.
o Improved speed of LONGINT arithmetic. Division enjoys fourfold
reduction of execution time on 8086, for an 80386 the speed up
factor is 6.7.
o Several of the functions of the heap manager have been tuned,
giving up to 10% faster operation for these routines.
o Set functions have been sped up by a few percent, but the add
variable range operation may be up to eight times as fast.
o UPCASE function has been enhanced to support complete the IBM character
set. This means that characters ä,ü,ö,å,æ,é,ñ,ç are converted to upper
case by this function.
o Several bugs have been fixed:
The Random function could return 1.0 when compiled in the $N+ state,
although the specifications call for a return value 0 <= Random < 1.
This has been corrected. Return values from Random will be strictly
smaller than 1 now.
GetDir now correctly returns a run-time error 15 (invalid drive)
when called with a non existent drive.
LONGINT Read and Val routines now accept the smallest LONGINT
number -2147483648 as decimal input.
For programs compiled with $N+, only true INFs are printed out as
INF where with the original library some NaNs are also printed as
INF. Correct operation can be tested with the INFBUG program.
Multiplication of REAL numbers by small integers was inaccurate,
causing among others problems unnecessary inaccuracies in binary
<-> decimal conversion. This has been eliminated with the new
REAL arithmetic modules.
REAL arithmetic EXP functions no longer signals overflow when
called with small arguments, but underflows to zero instead as it
should.
Denormals in EXTENDED computations no longer cause invalid state
on 8087 coprocessor when being converted to true zeros. Consistency
between register contents and tag bits is now asserted. Removal of
this bug can be tested with the BUG87 program.
Stack checking routine for programs compiled in the $S+ state now
reliably detects all stack overflows.
Program initialization routine now tries to prevent that programs
compiled with the $G+ (286 code generation) switch are run on 8086
and 8088. The checks done are not 100% safe, but catch most of these
cases, displaying the message "CPU > 8086 required" and aborting the
program instead of letting it crash. Note that this check lets programs
compiled with $G+ run on 80186 and V20/V30 processors, since these
have the ability to process all 80286 real mode instructions produced
by Turbo Pascal.
o Improved functionality only marginally increases overall code length
of the SYSTEM unit by 385 bytes (less than 2%). This is due to careful
optimizing in numerous routines. Most programs compiled with the new
RTL will be smaller due to finer granularity of the RTL modules.
Savings are usually in the 1 KB range for reasonably large programs.
Improvements in DOS module
--------------------------
o Decreased code size by careful optimization of register usage in
some routines.
Improvements in CRT module
--------------------------
o Bug fix in routine DirectWrite. The method used to prevent "snow"
when writing directly to a CGA graphics card was not entirely save.
When used in a heavily interrupted program (e.g. serial communication
as a background task), it would not always write during the time
when scanning was in the invisible parts of the screen. The method
used now is 100% save and is even faster, since it takes advantage
of the horizontal and vertical retrace periods, as opposed to the
old method which only used the horizontal retrace time. New routine
has been tested successfully on original IBM-CGA card.
Changes since first beta release (version 1.0, dated 03-21-92)
--------------------------------------------------------------
o Fixed bug in the routine that adds variable ranges to sets (as in
s := [foo..bar], where s is a set and foo and bar are variables of
the set's base type.
o Switched back code in the REAL add/subtract routine to plain 8086
code. Forgot to remove the use386 flag when building code for the
original release 1.0 beta.
Changes since the alpha release
-------------------------------
o There was an error in the 8087 float to string conversion in the
alpha release which has been fixed.
o A bug in the coprocessor identification that sets the Test8087 variable
present in the alpha release has been fixed.
o For string -> LONGINT conversion, it is now possible to input the
smallest LONGINT number -2147483648 in decimal.
o An enhanced argument reduction has been implemented for REAL arithmetic
SIN, COS, and EXP function, delivering much more accurate results over
the complete argument range. This has slowed these functions down
somewhat, however, none of them runs slower than in the original TP 6.01
RTL. As a result of the new argument reduction, arguments to SIN and
COS are restricted to the range -3.37325e9..3.37325e9 now. Arguments to
these functions were previously unrestricted. For arguments outside the
range given, an error 207 will result. This is consistent with the
coprocessor/emulator generated SIN/COS functions, that also signal
error 207 for arguments out of range (-9.22337e18..9.22337e18).
o SIN, COS, and ARCTAN functions compiled in the $N+ state will now use
the faster coprocessor instructions available on the 387 and 486 if
such a coprocessor/FPU is present.
o A check has been included to prevent programs compiled with $G+ (286 code
generation) to run on a 8086.
o The Random function has been fixed to return value strictly smaller than
1 when compiled with $N+.
References
----------
[1] IEEE: IEEE Standard for Binary Floating-Point Arithmetic.
SIGPLAN Notices, Vol. 22, No. 2, 1985, pp. 9-25
[2] IEEE Standard for Binary Floating-Point Arithmetic.
ANSI/IEEE Std 754-1985.
New York, NY: Institute of Electrical and Electronics Engineers 1985
[3] Karpinski, R.: Paranoia: A Floating-Point Benchmark.
Byte, February 1985, pp. 223-235
[4] Curnow, H.J.; Wichmann, B.A.: A synthetic benchmark.
Computer Journal, Vol. 19, No. 1, 1976, pp. 43-49
[5] Wichmannn, B.A.: Validation code for the Whetstone benchmark.
NPL Report DITC 107/88, National Physics Laboratory, UK, March 1988
[6] Cody, W.J.; Waite, W.: Software Manual for the Elementary Functions.
Englewood Cliffs, NJ: Prentice Hall 1980
[7] McMahon, H.H.: The Livermore Fortran Kernels: A Test of the Numerical
Performance Range.
Technical Report UCRL-53745, Lawrence Livermore National Laboratory,
December 1986, p. 179
[8] Weicker, R.P.: Dhrystone: A Synthetic Systems Programming Benchmark.
Communications of the ACM, Vol. 27, No. 10, October 1984, pp. 1013-1030
[9] Weicker, R.P.: Dhrystone Benchmark: Rationale for Version 2 and
Measurement Rules.
SIGPLAN Notices, Vol. 23, No. 8, August 1988, pp. 49-62
Note:
PARANOIA, DHRYSTONE, WHETSTONE, LLL, and ELEFUNT source code is
available from NETLIB@ORNL.GOV